package thread;

public class Demo14 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            while(true){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        t1.start();

        t1.join();//WAITTING状态

//        t1.join(6000 * 1000);//TIMED_WAITTING状态，有超时限制
        System.out.println("main end");
    }
}
